package com.yanxu;

/**
 * @author 折戟沉沙铁未销
 * @version V1.0
 * @date 2025/3/8-2025
 * @Description: 这里用一句话描述这个类的作用
 */
public class Test2 {
    public static void main(String[] args) throws InterruptedException {
        Student student = new Student();
        student.setAge(1);
        doRecursion(student);
    }

    private static void doRecursion(Student student) throws InterruptedException {
        try {
            while (student.getAge() <= 5) {
                System.out.println("start!!!");
                Thread.sleep(1000);
                student.setAge(student.getAge()+1);
                doRecursion(student);
            }

        }finally {
            System.out.println("end!!!");
        }
    }
}
class Student{
    int age;

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}